import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
import { ExecuteState } from './types';

export class BaseBehaviorConnection extends PolylineEdgeModel {
  protected executeState: ExecuteState = 'Inactive';

  getEdgeStyle() {
    const style = super.getEdgeStyle();
    const { properties } = this;
    if (properties.isActived) {
      style.strokeDasharray = '4 4';
    }
    style.stroke = (properties.executeState as ExecuteState) === 'Running' ? 'green' : 'orange';
    return style;
  }
}

export default {
  type: 'BaseBehaviorConnection',
  view: PolylineEdge,
  model: BaseBehaviorConnection,
};
